//
//  NSFileManager+Paths.m
//  category
//
//  Created by MAC on 2018/5/5.
//  Copyright © 2018年 MAC. All rights reserved.
//

#import "NSFileManager+Paths.h"

@implementation NSFileManager (Paths)

+ (NSURL *)ex_URLForDirectory:(NSSearchPathDirectory)directory
{
    return [self.defaultManager URLsForDirectory:directory inDomains:NSUserDomainMask].lastObject;
}

+ (NSString *)ex_pathForDirectory:(NSSearchPathDirectory)directory
{
    return NSSearchPathForDirectoriesInDomains(directory, NSUserDomainMask, YES)[0];
}

+ (NSURL *)ex_documentsURL
{
    return [self ex_URLForDirectory:NSDocumentDirectory];
}

+ (NSString *)ex_documentsPath
{
    return [self ex_pathForDirectory:NSDocumentDirectory];
}

+ (NSURL *)ex_libraryURL
{
    return [self ex_URLForDirectory:NSLibraryDirectory];
}

+ (NSString *)ex_libraryPath
{
    return [self ex_pathForDirectory:NSLibraryDirectory];
}

+ (NSURL *)ex_cachesURL
{
    return [self ex_URLForDirectory:NSCachesDirectory];
}

+ (NSString *)ex_cachesPath
{
    return [self ex_pathForDirectory:NSCachesDirectory];
}
@end
